#pragma once

namespace tri
{
	class CGraphic
	{
	public:
		CGraphic();
		~CGraphic();

		HRESULT InitWindow(HINSTANCE hInstance, int nCmdShow);
		HRESULT InitDevice();
		void CleanupDevice();
		static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
		void Render();

	private:
		HINSTANCE               m_hInst;
		HWND                    m_hWnd;
		D3D_DRIVER_TYPE         m_driver_type;
		D3D_FEATURE_LEVEL       m_feature_level;
		ID3D11Device*           m_d3d_device;
		ID3D11Device1*          m_d3d_device1;
		ID3D11DeviceContext*    m_immediate_context;
		ID3D11DeviceContext1*   m_immediate_context1;
		IDXGISwapChain*         m_swap_chain;
		IDXGISwapChain1*        m_swap_chain1;
		ID3D11RenderTargetView* m_main_render_target_view;
		ID3D11Texture2D*		m_frame_buffer_texture;
		ID3D11SamplerState*		m_sampler;
		ID3D11ShaderResourceView* m_frame_buffer_shader_view;
		ID3D11Buffer*			m_quad_vertex_buffer;
		ID3D11InputLayout*		m_quad_layout;
		ID3D11VertexShader*		m_quad_vs;
		ID3D11PixelShader*		m_quad_ps;
		int*					m_frame_buffer;
	};
}
